<script>
    // 四不像排序 反正能用 （更像是选择排序）
    var arr1 = [3,1,2,6,4,5,8,9,7]
    for(var i=0;i<arr1.length-1;i++){
        for(var j=i+1;j<arr1.length;j++){
            if(arr1[j]<arr1[i]){
                var num1 = arr1[i]
                arr1[i]=arr1[j]
                arr1[j]=num1
            }
        }
    }
    console.log(arr1)

    // 冒泡排序
    var arr2 = [3,1,2,6,4,5,8,9,7]
    for(var i = 0 ; i < arr2.length - 1 ; i++){
        for(var j = 0 ; j < arr2.length - 1 - i ; j++){
            if(arr2[j] > arr2[j + 1]){
                var num2 = arr2[j]
                arr2[j] = arr2[j + 1]
                arr2[j + 1] = num2
            }
        }
    }
    console.log(arr2)
</script>